package com.zc.demo.di;

import com.zc.demo.di.interfaces.Poem;

/**
 * 定义诗歌类扩展杂技师duke的才能
 * Created by zhangchi9 on 2016/11/2.
 */
public class PoeticJuggler extends Juggler {

    private Poem poem;//定义poem接口的引用

    /**
     * 注入诗歌接口
     * @param poem
     */
    public PoeticJuggler(Poem poem){
        super();
        this.poem = poem;
    }

    /**
     * 注入豆沙包的数量和诗歌接口
     * @param beanBages
     * @param poem
     */
    public PoeticJuggler(int beanBages,Poem poem){
        super(beanBages);
        this.poem = poem;
    }

    public void perform(){
        super.perform();
        System.out.println("While reciting ...");
        poem.recite();
    }
}
